home *** CD-ROM | disk | FTP | other *** search
-
-
- PASCLIB Version 1.0 (Copyright 1985)
- =======================================================================
- by: Gerry L. Kilgore
- 1725 Kellogg Springs Dr.
- Dunwoody, GA 30338
- (404) 396-6107 (Voice)
- =======================================================================
-
- PASCLIB is a library of floating point subroutines, a sine/cosine sub-
- routine, a random number function and a ramdomize program to seed the
- random number generator.
-
- The library was written in Assembler language primarily to interface
- with IBM/MS Pascal programs to obtain great speed without giving up
- single precision accuracy such as required by graphics programs using
- mathematical functions or plotting. Other applications, not requiring
- the accuracy of long precision can, of course, benefit from use of this
- library.
-
- WHY BOTHER?? Simply put, because they perform approximately five (5)
- times faster that the equivalent operations using short precision in
- IBM/MS Pascal. They are not hampered by generalized overhead.
-
- The library is equally useable by Assembler Language programmers. In
- fact, it was constructed with a separate EXTERNAL interface which, in
- turn, calls the INTERNAL routines. The Assembler Language programmer
- can bypass the EXTERNAL interface and go directly to the INTERNAL
- routines, if he obtains the A/L source. If not, he may still use the
- EXTERNAL calls.
-
- I am declaring this program in the Public Domain under the Freeware
- Concept. That is, you are free to copy and distribute this library
- as long as you do so without financial gain. If you find it useful,
- and feel that it is justified, this author will not turn down any
- contributions ($20.00 is reasonable). For your contribution of at
- least $20.00 along with a self-addressed diskette mailer with return
- postage affixed, I will send you a diskette with the commented
- Assembler Language source of PASCLIB, additional documentation on how
- to call the internal routines, and I will put you on my mailing
- list for notification of fixes, enhancements and upgrades. Send
- contributions to the address shown above.
-
- DISCLAIMER: This author will not be held accountable for any
- problems or damages associated with the use of PASCLIB whether they
- be physical, financial or psychological. If you use PASCLIB, you
- use it at your own risk!
-
- ======================================================================
-
-
- WHAT'S IN THE PACKAGE?
- ======================
-
- You have:
- PASCLIB.INC - the "INCLUDE" file for IBM/MS Pascal
- PASCLIB.OBJ - the subroutine object module.
- PASCLIB.DOC - this documentation.
-
- In IBM/MS Pascal, you must place an "INCLUDE" statement in your
- program as if you were defining a function or procedure. This will
- permit you to invoke the Functions and Procedures of PASCLIB.OBJ.
- That statement will be as follows:
-
- {$INCLUDE:'PASCLIB.INC'}
-
- with no semi-colon following the statement. You may, of course, pre-
- cede the name, PASCLIB.INC, with a drive specifier, such as,
-
- {$INCLUDE:'B:PASCLIB.INC'}
-
- if PASCLIB.INC is not on the default drive.
-
- PASCLIB.INC contains the following external procedure and function
- definitions:
-
- procedure randomize; external;
- function random ( n : integer): integer; external;
- function f_add( op1, op2: real): real; external;
- function f_sub( op1, op2: real): real; external;
- function f_mult(op1, op2: real): real; external;
- function f_div( op1, op2: real): real; external;
- procedure sinlook( arg: integer; var sin: real); external;
- procedure coslook( art: integer; var cos: real); external;
- function ifloat( arg: integer): real; external;
- function fltrunc( arg: real): integer; external;
- function fround( arg: real): integer; external;
- function fltmod (art: real): real; external;
- function rsin( arg: real): real; external;
- function rcos( arg: real): real; external;
- function craddeg( rad: real): real; external;
-
- In addition, you will need to insert the follwoing statement in
- your program in order to tell IBM/MS Pascal that you are working
- with SHORT Precision real numbers:
-
- procedure mpsrqq; external;
-
- This procedure is internal to the PASCAL.LIB library and is linked
- into your program automatically when you perform the LINK function.
-
-
- HOW DO I USE THEM?
-
- 1. Randomize is a procedure with no arguments. It seeds the random
- number generator for the function, Random. This is accomplished
- by accessing the system clock or timer.
-
- Use:
-
- randomize;
-
- That's all there is to that one.
-
-
-
- 2. Random is a function that returns a random integer.
-
- Use:
-
- y := random(a);
-
- or
-
- if ( random(a) > 50 ) then ........
-
- 'a' must be an integer and random (a) will return a random
- integer such that
-
- 0 < random(a) < a.
-
-
- 3. F_add is a function that performs a single precision floating point
- add of two real numbers returning their real sum.
-
- Use:
-
- y := f_add (a, b);
-
- Adds 'b' to 'a' and returns their sum in y.
-
-
- 4. F_sub is the same as f_add, except for,
-
- y := f_sub (a, b);
-
- 'b' is subtracted FROM 'a' and the difference is stored in 'y'.
-
-
- 5. F_mult is a function that performs a single precision floating
- point multiplication of two real numbers returning their real prod-
- duct.
-
- Use:
-
- y := f_mult(a, b);
-
- 'a' is multiplied by 'b' and the product is stored in 'y'. I might
- add that these functions can be nested. For example:
-
- z := f_add ( f_mult ( a, b ), c );
-
- is completely valid, since f_mult ( a, b ) is a real number and we
- presume that so is 'c'.
-
-
-
- 6. F_div is the floating point division function where if,
-
- y := f_div (a, b);
-
- then 'a' is divided BY 'b' and the quotient is stored in 'y'. In
- this case, 'a' is the dividend and 'b' is the divisor. Division
- by zero returns a zero, by the way.
-
-
- 7. Sinlook is a procedure that returns a real number which is the
- trignometric sine of an integer number of degrees. PASLIB.OBJ
- contains a sine/cosine table of the real sine of integer degrees.
- It can very quickly determine the sine of a number by performing
- a binary search on this table.
-
- Use:
-
- sinlook (a , b);
-
- where 'a' is the integer representation of the number of degrees
- and the sine of 'a' is returned in the real variable, 'b'. (Note
- that while 'a' may be a literal, 'b' MUST be a variable) For
- example:
-
- sinlook (30, b);
-
- returns the sine of 30 degrees as a real variable in 'b'.
-
-
- 8. Coslook is the same as sinlook except that it returns the cosine
- in the second variable. Thus,
-
- coslook (45, x);
-
- places the cosine of 45 degrees in the real variable, 'x'.
-
-
- 9. Ifloat is a function which creates a real number out of an integer.
- Though you can accomplish this with a simple assignment statement in
- Pascal, Ifloat performs it much, much faster.
-
- Use:
-
- y := ifloat (30);
-
- creates the internal floating point representation of '30' and puts it
- in the real variable, 'y'. It is included primarily for speed.
-
-
-
- 10. Fltrunc takes a real number and essentially throws away the fractio-
- nal portion of the n